{% extends 'PHPDishWebBundle:User:view_common.html.twig' %}

{% set tab = 'topic' %}

{% if topics.count %}
    {% block entry_meta %}
        <span>共发表了{{ topics.count }}个话题</span>
    {% endblock %}
{% endif %}

{% block user_content %}
    {% if topics.count %}
        <ul class="list-group resource-list">
            {% for topic in topics %}
            <li class="list-group-item">
                <div class="title"><a href="{{ path('topic_view', {'id': topic.id}) }}">{{ topic.title }}</a></div>
                <span class="meta">
                    {{ topic.createdAt|time_diff }} 发表在 <a href="{{ path('thread_view', {'slug':  topic.thread.slug}) }}">{{ topic.thread.name }}</a>
                </span>
            </li>
            {% endfor %}
        </ul>
        {% if topics.haveToPaginate %}
            <footer class="panel-footer">
                {{ pagerfanta(topics, 'twitter_bootstrap3') }}
            </footer>
        {% endif %}
    {% else %}
        <div class="empty-data">
            <p><i class="if i-comment"></i> 还没有发表过话题</p>
        </div>
    {% endif %}
{% endblock %}